<template>
  <div>
    <h2>home</h2>
    item模块中的num
    <button @click="addNum">+</button>
    {{ itemNum }}
    <hr>
    cate模块中的num
    {{ cateNum }}
    <el-button>按钮</el-button>
    <el-rate ></el-rate>
  </div>
</template>

<script>
import { mapMutations, mapState } from 'vuex'
export default {
  methods: {
    addNum () {
      // this.$store.commit('item/add_num', 5)
      // this['item/add_num'](5)
      this.add_num(5)
    },
    // ...mapMutations(['item/add_num'])
    ...mapMutations('item', ['add_num'])
  },
  computed: {
    ...mapState({
      itemNum: state => state.item.num,
      cateNum: state => state.cate.num
    })
  },
  mounted () {
    console.log(this.$store)
  }
}
</script>

<style lang="scss" scoped>

</style>
